package org.bluedream.core.module.sys.entity.dict;

import com.baomidou.mybatisplus.annotation.TableName;
import lombok.*;
import org.bluedream.comm.base.OrgPageEntity;
import org.bluedream.comm.base.PageEntity;
import org.hibernate.validator.constraints.Length;

import javax.validation.constraints.Pattern;

/**
 * @ClassName DictType
 * @Description TODO
 * @Author foxsand
 * @Data 2021-09-09 16:07
 * @Version
 */
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = false)
@NoArgsConstructor
@TableName(value = "SYS_DICT_TYPE")
public class DictType extends OrgPageEntity<DictType> {
    private static final long serialVersionUID = -3261810958493647449L;

    @NonNull
    private String dictType;
    @NonNull
    private String dictName;
    private String isSys;

    @Length(
            min = 0,
            max = 100,
            message = "字典类型名称长度不能超过 100 个字符"
    )
    public String getDictName(){
        return this.dictName;
    }

    @Pattern(
            regexp = "[a-zA-Z0-9_]{3,64}",
            message = "字典分类长度应为 3 到 64 个字符，并且只能包含字母、数字、下划线"
    )
    public String getDictType(){
        return this.dictType;
    }

    public DictType(Long limit , Long pageSize){
        this.limit = limit;
        this.page = pageSize;
    }

    public DictType(String id) {
        this.id = id;
    }
}
